home *** CD-ROM | disk | FTP | other *** search
/ Chip 1996 November / Chip 11-96.iso / treiber / drucker / lexmark / optrae / windows / optraewi.exe / LINPRTPT.ZIP / PRTPORT.LIN
INI File  |  1995-11-06  |  16KB  |  504 lines

  1. [Variables]
  2. ;
  3. ; >>>
  4. ; >>> BEGINNING OF NLS -- Start translating here.
  5. ; >>>
  6. ; >>> Do not translate the variable name on the left, only translate the
  7. ; >>> quoted string.
  8. ; >>>
  9. ;
  10.  
  11. $Str_Prompt_MakeDefault = "Do you want to make this your default printer?"
  12. $Str_Prompt_TestDrivers = "The installed device drivers can be tested by sending a test page to the printer.  Do you wish to try this now?"
  13. $Str_Prompt_TestConnection = "Do you want to test the connection between your printer and computer?  Make sure the cables are attached first."
  14. $Str_Prompt_TestingConnection = "Testing printer connection.  Please wait..."
  15. $Str_Prompt_PrinterPort = "The driver software works with several different printer models.  To function properly, it must know what type of printer is attached.\n\nPlease select your printer model and port below."
  16. $Str_Prompt_Port = "Your printer can be connected to your computer through one of the ports listed below.\n\nPlease select the port which you will be using."
  17. $Str_Prompt_BothDrivers = "You have installed both language drivers for this printer.  Choose one as the default."
  18.  
  19. $Str_CompName_DemoPS = "PostScript Test Pages"
  20.  
  21. ; >>>
  22. ; >>> END OF NLS -- Stop translating here
  23. ; >>>
  24.  
  25.  
  26. ;
  27. ; The name of the misc scripts directory on the server
  28. ;
  29. ;$Dir_Scripts = "scripts"
  30.  
  31.  
  32. ;
  33. ; Other globals...
  34. ;
  35.  
  36. $Str_Optra_R = "Lexmark Optra R LaserPrinter"
  37. $Str_Optra_L = "Lexmark Optra L LaserPrinter"
  38. $Str_Optra_LX = "Lexmark Optra Lx LaserPrinter"
  39. $Str_Optra_RX = "Lexmark Optra Rx LaserPrinter"
  40. $Str_Optra_RT = "Lexmark Optra Rt LaserPrinter"
  41.  
  42. $Str_Optra_Rp = "Lexmark Optra R plus LaserPrinter"
  43. $Str_Optra_RTp = "Lexmark Optra Rt plus LaserPrinter"
  44. $Str_Optra_LXp = "Lexmark Optra Lx plus LaserPrinter"
  45. $Str_Optra_LXIp = "Lexmark Optra Lxi plus LaserPrinter"
  46.  
  47. $Str_Rainbow = "Lexmark Optra C PS2"
  48. $Str_OptraN = "Lexmark Optra N"
  49. $Str_Sunflower = "Lexmark Sunflower"
  50.  
  51. $Str_Rockwell_150c = "Lexmark WinWriter 150c"
  52.  
  53. $Str_Ruby = "Lexmark Color 4079 plus PS2"
  54.  
  55.  
  56. $Force_Printer_Type = ""
  57. $Printer_Type = $Force_Printer_Type
  58. $Force_Port = ""
  59. $Port = $Force_Port
  60. $Print_Sample = $YES
  61. $Printer_Becomes_Default = $YES
  62. $ConnectionTested = "N"
  63. $MVWinINISection = "MarkVision"
  64.  
  65.  
  66. ;
  67. ; Globals from other scripts.  Defining them in this way allows the file to
  68. ; still be parsable regardless of the ordering of files.
  69. ;
  70. $Str_PCL5 = $Str_PCL5                                        ; pcl.lin
  71. $Install_PCL5 = $Install_PCL5                                ; pcl.lin
  72. $TrueDevice_PCL5 = $TrueDevice_PCL5                        ; pcl.lin
  73. $Driver_PCL5 = $Driver_PCL5                                ; pcl.lin
  74.  
  75. $Str_PostScript = $Str_PostScript                        ; ps.lin
  76. $Install_PostScript = $Install_PostScript                ; ps.lin
  77. $TrueDevice_PS = $TrueDevice_PS                            ; ps.lin
  78. $Driver_PostScript = $Driver_PostScript                ; ps.lin
  79.  
  80. $Str_Rockwell = $Str_Rockwell                                ; rockdrv.lin
  81. $Install_RockwellDriver = $Install_RockwellDriver    ; rockdrv.lin
  82. $TrueDevice_Rockwell = $TrueDevice_Rockwell            ; rockdrv.lin
  83. $Driver_Rockwell = $Driver_Rockwell                        ; rockdrv.lin
  84.  
  85. $ShowSerial = $ShowSerial                                    ; 'product'.lin
  86.  
  87.  
  88. ;
  89. ; Temporary strings
  90. ;
  91. $TempString = ""
  92. $TempString2 = ""
  93. $TempString3 = ""
  94.  
  95.  
  96.  
  97.  
  98. [Libraries]
  99.  
  100. PrintUtility = linutil.dll
  101.  
  102.  
  103.  
  104. [Disks]
  105.  
  106. PrtSetup = $Str_Disk_Setup, setupdsk.bmp, 255, 0, 0
  107.  
  108.  
  109.  
  110. [Components]
  111.  
  112. DemoPS = $Str_CompName_DemoPS, , $TEMPDIR, PrtSetup, 122, demos.zip
  113.  
  114. ; Server components
  115. Server_PrtPort = "", , $SERVERAPPDIR, PrtSetup, 29,
  116.                  (=prtport.lin, =linutil.dll)
  117. Server_DemoPS = $Str_CompName_DemoPS, , $SERVERAPPDIR, PrtSetup, 32, demos.zip
  118.  
  119.  
  120.  
  121.  
  122. [Macros]
  123.  
  124. ; ConnectPrinter:            This macro connects a printer to a port.
  125. ;                                This is done by setting up the win.ini
  126. ;                                [devices] and [printerports] sections.
  127. ;                                The tricky part is when we have more than
  128. ;                                one device for a given port.
  129. ;
  130. ;                                Parameter examples:
  131. ;                                    $driver = "ww150c.drv"
  132. ;                                    $truedevice = "Lexmark WinWriter 150c"
  133. ;                                    $port = "LPT1"
  134. ;
  135. ConnectPrinter($driver, $truedevice, $port)
  136.     (
  137.     ; First add a colon to the port
  138.     SetVariable($port, ($port, ":"))
  139.  
  140.     ; Internal uses for temp strings:
  141.     ;
  142.     ;        $TempString        Original value of [devices] or [PrinterPorts] entry
  143.     ;        $TempString2    Working copy of $TempString
  144.     ;        $TempString3    "n": driver not being used yet at all
  145.     ;                            "u": driver already using this port
  146.     ;                            "a": driver exists, we have to add this port
  147.  
  148.     ; First, is this driver already being used on a port?
  149.     GetINI($WININI, "devices", $truedevice, $TempString)
  150.     SetVariable($TempString2, $TempString)
  151.     RemoveToken($TempString2, ",", $port)
  152.     IfEqual($TempString, "",
  153.         SetVariable($TempString3, "n"),
  154.         IfEqual($TempString2, $TempString,
  155.             SetVariable($TempString3, "a"),
  156.             SetVariable($TempString3, "u")))
  157.  
  158.     ; [devices]
  159.     IfEqual($TempString3, "n",
  160.         SetVariable($ConnectPrinter, ($driver, ",", $port)),
  161.         IfEqual($TempString3, "a",
  162.             SetVariable($ConnectPrinter, ($TempString, ",", $port))))
  163.     IfEqual($TempString3, "u", NOP(),
  164.         SetINI($WININI, "devices", $truedevice, $ConnectPrinter))
  165.  
  166.     ; [PrinterPorts]
  167.     GetINI($WININI, "PrinterPorts", $truedevice, $TempString)
  168.     IfEqual($TempString3, "n",
  169.         SetVariable($ConnectPrinter, ($ConnectPrinter, ",15,45")),
  170.         IfEqual($TempString3, "a",
  171.             SetVariable($ConnectPrinter, ($TempString, ",", $port, ",15,45"))))
  172.     IfEqual($TempString3, "u", NOP(),
  173.         SetINI($WININI, "PrinterPorts", $truedevice, $ConnectPrinter))
  174.     )
  175.  
  176.  
  177.  
  178. ; MakeDefaultPrinter:    Make the given printer the default printer.
  179. ;                                The return value is empty (we use the return
  180. ;                                value for a temporary string.)
  181. ;
  182. ;                                The assumption is made that the following external
  183. ;                                variables are already set:
  184. ;
  185. ;                                    $TrueDevice_PS
  186. ;                                    $TrueDevice_PCL5
  187. ;                                    $TrueDevice_Rockwell
  188. ;                                    $Str_PCL5
  189. ;                                    $Str_PostScript
  190. ;                                    $Str_Rockwell
  191. ;                                    $Install_PCL5
  192. ;                                    $Install_PostScript
  193. ;                                    $Install_RockwellDriver
  194. ;                                    $Driver_PCL5
  195. ;                                    $Driver_PostScript
  196. ;                                    $Driver_Rockwell
  197. ;
  198. MakeDefaultPrinter($printer_type, $port)
  199.     (
  200.     ; Choices:    Rockwell,
  201.     ;                PS
  202.     ;                PCL5
  203.     ;                PS and PCL5
  204.     ;
  205.    ;grw:950801 - This program was never used for Rockwell, so that stuff can
  206.    ;            be removed.  Other things could probably also be cleaned-up, such
  207.    ;            as: The passed-in paramter '$printer_type' is not referenced, it
  208.    ;            is SET in the 'Which name?' section below.  Besides, it is global.
  209.    ;
  210.     IfEqual($Install_RockwellDriver, "Y",
  211.         SetVariable($MakeDefaultPrinter, $Str_Rockwell),
  212.         IfEqual($Install_PostScript, "Y",
  213.             IfEqual($Install_PCL5, "Y",
  214.                 SetVariable($MakeDefaultPrinter, "both"),
  215.                 SetVariable($MakeDefaultPrinter, $Str_PostScript)),
  216.             SetVariable($MakeDefaultPrinter, $Str_PCL5)))
  217.  
  218.     ; When both PS and PCL5 are supported, we need to ask which one they want,
  219.     ; unless they are in Express Mode, in which case we pick the PCL driver.
  220.     IfEqual($MakeDefaultPrinter, "both",
  221.         IfEqual($INSTALLMODE, "E",
  222.             SetVariable($MakeDefaultPrinter, $Str_PCL5),
  223.             ChooseFromList($MakeDefaultPrinter, $Str_Prompt_BothDrivers,
  224.                 ($Str_PostScript, $Str_PCL5), $Str_PCL5, , $HelpID_DefaultDriver)))
  225.  
  226.     ; Which driver?
  227.     IfEqual($MakeDefaultPrinter, $Str_PostScript,
  228.         SetVariable($MakeDefaultPrinter, $Driver_PostScript),
  229.         IfEqual($MakeDefaultPrinter, $Str_Rockwell,
  230.             SetVariable($MakeDefaultPrinter, $Driver_Rockwell),
  231.             SetVariable($MakeDefaultPrinter, $Driver_PCL5)))
  232.  
  233.     ; Which name?
  234.     IfEqual($MakeDefaultPrinter, $Driver_PostScript,
  235.         SetVariable($printer_type, $TrueDevice_PS),
  236.         IfEqual($MakeDefaultPrinter, $Driver_PCL5,
  237.             SetVariable($printer_type, $TrueDevice_PCL5),
  238.             SetVariable($printer_type, $TrueDevice_Rockwell)))
  239.  
  240.     ; Adjust win.ini to reference this as the default
  241.     SetVariable($MakeDefaultPrinter,
  242.         ($printer_type, ",", $MakeDefaultPrinter, ",", $port, ":"))
  243.     SetINI($WinINI, "windows", "device", $MakeDefaultPrinter)
  244.     )
  245.  
  246.  
  247.  
  248. ; DefaultPrinter:    Make this the default printer.
  249. ;                        No return value.
  250. ;
  251. DefaultPrinter()
  252.     (
  253.     ; Make this the default printer?  In "custom" mode, let the user decide,
  254.     ; in Express mode, always do it, in other modes (driver, etc...)
  255.  
  256.     IfEqual($INSTALLMODE, "C",
  257.         ChooseYesNo($DefaultPrinter, $Str_Prompt_MakeDefault, $YES,
  258.                         $HelpID_DefaultPrinter),
  259.         IfEqual($INSTALLMODE, "E",
  260.             SetVariable($DefaultPrinter, $YES),
  261.             SetVariable($DefaultPrinter, $NO)))
  262.  
  263.     IfEqual($DefaultPrinter, $YES,
  264.         CallMacro(MakeDefaultPrinter, , ($Printer_Type, $Port)))
  265.  
  266.     ; Test the device driver?  The default response is their response from
  267.     ; the previous dialog...  This is not used for Rockwell.
  268.     IfEqual($Install_RockwellDriver, "",
  269.         ChooseYesNo($DefaultPrinter, $Str_Prompt_TestDrivers, $DefaultPrinter,
  270.                         $HelpID_TestDriver),
  271.         SetVariable($DefaultPrinter, $NO))
  272.     IfEqual($DefaultPrinter, $YES, CallMacro(PrintTestPage, , ))
  273.     )
  274.  
  275.  
  276.  
  277. ; TestConnection:    Sends a sample PS file to the printer.
  278. ;                        No return value.
  279. ;
  280. ;                        Requires that $Port already be defined.
  281. ;
  282. TestConnection()
  283.     (
  284.     ; Install the demos to the temporary directory
  285.     InstallComponent(DemoPS)
  286.  
  287.     ; Send the PostScript file to the printer
  288.     MakePathName($TestConnection, , $TEMPDIR, "feature.ps")
  289.     ShowMessage($Str_Prompt_TestingConnection)
  290.     CopyFile($TestConnection, $Port)
  291.  
  292.     ; Prevent this from being called again...  When CopyFile fails, the
  293.     ; macro will have been aborted already, so this instruction will not
  294.     ; to be executed unless we successfully tested the connection.
  295.     SetVariable($ConnectionTested, "Y")
  296.  
  297.     ShowMessage("")
  298.     )
  299.  
  300.  
  301.  
  302. ; OptraPrinterAndPort:    Determine which printer type and port the user
  303. ;                                wishes to connect drivers to.
  304. ;                                No return value.
  305. ;
  306. OptraPrinterAndPort()
  307.     (
  308.     ; For express, if they have not already choosen a port, use LPT1 by default
  309.     IfEqual($INSTALLMODE, "E",
  310.         IfEqual($Port, "", SetVariable($Port, "LPT1")))
  311.  
  312.     ; What type of printer and port?  Ask only when the port and printer
  313.     ; are not already defined.
  314.     SetVariable($OptraPrinterAndPort, "N")
  315.  
  316.     IfEqual($Port, "",
  317.         SetVariable($OptraPrinterAndPort, "Y"),
  318.         IfEqual($Printer_Type, "", SetVariable($OptraPrinterAndPort, "Y")))
  319.  
  320.     IfEqual($OptraPrinterAndPort, "Y",
  321.         CallLibrary(PrintUtility, ChoosePrinterPort, ,
  322.             ($Str_Prompt_PrinterPort, "$Printer_Type", "$Port",
  323.             $HelpID_PrinterPort, "Y",
  324.             $Str_Optra_R, $Str_Optra_L, $Str_Optra_LX,
  325.          $Str_Optra_RX, $Str_Optra_RT)))
  326.  
  327.     ; Test the connection?
  328.     SetVariable($OptraPrinterAndPort, "N")
  329.  
  330.     IfEqual($ConnectionTested, "N",
  331.         ChooseYesNo($OptraPrinterAndPort, $Str_Prompt_TestConnection,
  332.                     "Y", $HelpID_TestConnection))
  333.  
  334.     IfEqual($OptraPrinterAndPort, "Y", CallMacro(TestConnection, , ))
  335.     )
  336.  
  337.  
  338.  
  339. ; RubyPrinterAndPort:    Determine which port the user wishes to connect
  340. ;                         the driver to.  No return value.
  341. ;
  342. RubyPrinterAndPort()
  343.     (
  344.     ; For express, if they have not already choosen a port,
  345.         ;   use LPT1 by default
  346.     IfEqual($INSTALLMODE, "E",
  347.         IfEqual($Port, "", SetVariable($Port, "LPT1")))
  348.  
  349.  
  350.     SetVariable($Printer_Type, $Str_Ruby)
  351.  
  352.     ; What port?  Ask only when the port is not already defined.
  353.     IfEqual($Port, "",
  354.         CallLibrary(PrintUtility, ChoosePrinterPort, ,
  355.             ($Str_Prompt_Port, "$Printer_Type", "$Port",
  356.             $HelpID_PrinterPort, "Y")))
  357.  
  358.  
  359.     ; Set the win.ini flag to tell MarkVision which port this is attached to
  360.    ; grw:950410 - Removing this stuff per SEdwards.  This 'paragraph' was
  361.    ; in golden US-English (Ruby) but won't be in the NLS builds.
  362. ;    IfEqual($Port, "LPT1",
  363. ;        SetVariable($RubyPrinterAndPort, "1"),
  364. ;        IfEqual($Port, "LPT2",
  365. ;            SetVariable($RubyPrinterAndPort, "2"),
  366. ;            IfEqual($Port, "LPT3",
  367. ;                SetVariable($RubyPrinterAndPort, "3"),
  368. ;                SetVariable($RubyPrinterAndPort, "4"))))
  369. ;    SetINI($WININI, $MVWinINISection, "InstallPort", $RubyPrinterAndPort)
  370.  
  371.  
  372.     ; Test the connection?
  373.     )
  374.  
  375.  
  376.  
  377. ; GenPort:    Determine which port to connect the driver to.  This macro
  378. ;           should be generic for any printer w/ only one type.
  379. ;           This macro should be called in place of 'product'printerandport.
  380. ;           The parameter is THE standard string-name of the printer, as in
  381. ;              '$Str_Ruby', or '$Str_Rainbow.'
  382. ;
  383. GenPort($Printer_Name)
  384.     (
  385.     ; For express, if they have not already choosen a port,
  386.    ;   use LPT1 by default
  387.     IfEqual($INSTALLMODE, "E",
  388.         IfEqual($Port, "", SetVariable($Port, "LPT1")))
  389.  
  390.     SetVariable($Printer_Type, $Printer_Name)
  391.  
  392.  
  393.     ; What port?  Ask only when the port is not already defined.
  394.     IfEqual($Port, "",
  395.         CallLibrary(PrintUtility, ChoosePrinterPort, ,
  396.             ($Str_Prompt_Port, "$Printer_Type", "$Port",
  397.             $HelpID_PrinterPort, $ShowSerial)))
  398.     )
  399.  
  400.  
  401. ;
  402. ;; WrigleyPrinterAndPort:    Determine which printer type and port the user
  403. ;;                                    wishes to connect drivers to.
  404. ;;                                    No return value.
  405. ;;
  406. ;WrigleyPrinterAndPort()
  407. ;    (
  408. ;    ; For express, if they have not already choosen a port, use LPT1 by default
  409. ;    IfEqual($INSTALLMODE, "E",
  410. ;        IfEqual($Port, "", SetVariable($Port, "LPT1")))
  411. ;
  412. ;    ; What type of printer and port?  Ask only when the port and printer
  413. ;    ; are not already defined.
  414. ;   ;grw:950801 - We don't get here unless we are installing at least one
  415. ;   ;                    of the drivers, PS or PCL.  If not installing PCL driver,
  416. ;   ;                    we don't need to know '$Printer_Type' .
  417. ;    SetVariable($WrigleyPrinterAndPort, $NO)
  418. ;
  419. ;    IfEqual($Port, "",
  420. ;        SetVariable($WrigleyPrinterAndPort, $YES),
  421. ;        IfEqual($Printer_Type, "", SetVariable($WrigleyPrinterAndPort, $YES)))
  422. ;
  423. ;    IfEqual($WrigleyPrinterAndPort, $YES,
  424. ;        CallLibrary(PrintUtility, ChoosePrinterPort, ,
  425. ;            ($Str_Prompt_PrinterPort, "$Printer_Type", "$Port",
  426. ;            $HelpID_PrinterPort, $YES,
  427. ;            $Str_Optra_Rp, $Str_Optra_RTp, $Str_Optra_LXp, $Str_Optra_LXIp)))
  428. ;    )
  429. ;
  430.  
  431.  
  432. ; WrigleyPrinterAndPort:    Determine which printer type and port the user
  433. ;                                    wishes to connect drivers to.
  434. ;
  435. WrigleyPrinterAndPort()
  436.     (
  437.     ; For express, if they have not already choosen a port, default to LPT1
  438.     IfEqual($INSTALLMODE, "E",
  439.         IfEqual($Port, "", SetVariable($Port, "LPT1")))
  440.  
  441.     ; What type of printer and port?  Ask only when the port and printer
  442.     ; are not already defined.
  443.    ;grw:950801 - We don't get here unless we are installing at least one
  444.    ;                    of the drivers, PS or PCL.  If not installing PCL driver,
  445.    ;                    we don't need to know '$Printer_Type' .
  446.  
  447.     ; Do we need to ask for printer type?
  448.    SetVariable($TempString, $NO)
  449.     IfEqual($Printer_Type, "",
  450.        IfEqual($Install_PCL5, $YES, SetVariable($TempString, $YES)))
  451.  
  452.     ; ask for printer & port, just port, or neither?
  453.    ; We always do port if printer, never just printer.
  454.    SetVariable($WrigleyPrinterAndPort, "none")
  455.     IfEqual($TempString, $YES,
  456.           SetVariable($WrigleyPrinterAndPort, "both"),
  457.       IfEqual($Port, "",
  458.            SetVariable($WrigleyPrinterAndPort, "port")))
  459.  
  460.     IfEqual($WrigleyPrinterAndPort, "both",
  461.         CallLibrary(PrintUtility, ChoosePrinterPort, ,
  462.             ($Str_Prompt_PrinterPort, "$Printer_Type", "$Port",
  463.             $HelpID_PrinterPort, $YES,
  464.             $Str_Optra_Rp, $Str_Optra_RTp, $Str_Optra_LXp, $Str_Optra_LXIp)),
  465.         IfEqual($WrigleyPrinterAndPort, "port",
  466.             CallLibrary(PrintUtility, ChoosePrinterPort, ,
  467.                 ($Str_Prompt_Port, "$Printer_Type", "$Port",
  468.                 $HelpID_PrinterPort, $YES))))
  469.     )
  470.  
  471.  
  472.  
  473. ; PrintTestPage:    Prints test pages for PS and PCL drivers.
  474. ;                        No return value.
  475. PrintTestPage()
  476.     (
  477.     IfEqual($Install_PCL5, $YES, CallMacro(PrintPCLTestPage, , ))
  478.     IfEqual($Install_PostScript, $YES, CallMacro(PrintPostScriptTestPage, , ))
  479.     )
  480.  
  481.  
  482.  
  483. ; ForceVariables:    Set variables which are influenced by $Force_xxx
  484. ;                        variables to their default state
  485. ;
  486. ForceVariables()
  487.     (
  488.     SetVariable($Port, $Force_Port)
  489.     SetVariable($Printer_Type, $Force_Printer_Type)
  490.     )
  491.  
  492.  
  493.  
  494. ; Initialize:    Called before any other macros are run and before any
  495. ;                    GUI stuff is shown.
  496. ;                    The return value is meaningless (used as a temporary string.)
  497. ;
  498. Initialize()
  499.     (
  500.     ; Initialize some global variables
  501.     CallMacro(ForceVariables, , )
  502.     )
  503.  
  504.